/* 
 * StartupListener.java      1.00    2008-01-11
 *
 * Copyright (c) 2010 leewan. All Rights Reserved.
 * 
 * This software is the confidential and proprietary information
 * of leewan.  You shall not disclose such Confidential Information
 * and shall use it only in accordance with the terms of the license agreement
 * you entered into with leewan.
 */
package doit.framework.listener;

import javax.servlet.ServletContextEvent;
import javax.servlet.ServletContextListener;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.web.context.ContextLoaderListener;

import doit.framework.util.Config;
import doit.framework.util.MessageGenerator;

/**
 * <pre>
 * system      : 공통
 * menu        : 공통
 * source      : StartupListener.java
 * description : 서버 시작/종료 리스너
 * </pre> 
 * @version
 * <pre> 
 * 1.0  2008-01-11  leewan  최초 작성
 * 1.1  
 * </pre>
 */

public class StartupListener extends ContextLoaderListener implements ServletContextListener {

    private static final Log logger = LogFactory.getLog(StartupListener.class);

    public void contextInitialized(ServletContextEvent event) {
        super.contextInitialized(event);

        setupContext();
    }
    
    public static void setupContext() {
        logger.info("##################################################################################################################");
        logger.info("Initializing context...");

        Config.init();  // config.xml 초기화
        MessageGenerator.makeMessageJS();   // message.js 생성
    
        logger.debug("Initialization complete [OK]");
        logger.info("##################################################################################################################");
    }
}
